<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * @version $Id: showplan.php 1126 2008-06-09 05:45:04Z julienv $
 * @package Joomleague
 * @copyright Copyright (C) 2007  JoomLeague
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see _joomleague_license.txt
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 
  function showPlan($jl_func, $tid, &$overall_config) {
    global $database, $joomleague;
    global $htmlHelper;
    
		$team_plan = $tid;
    $showPlan_config=$joomleague->getTemplateConfig("show_plan.tpl");
    
    if (!isset($_REQUEST['mode'])) $mode=$showPlan_config['mode'];
    else 
      $mode=intval(mosGetParam($_REQUEST, 'mode', 0));
    
  	$divisionid = intval(mosGetParam($_REQUEST, 'division', 0));
  	if ($divisionid > 0) {
  	  $division = new LeagueDivision($database);
  	  $division->load($divisionid);
  	}
    //new for plan order
		$ordering=($showPlan_config['plan_order'])?$showPlan_config['plan_order']:"DESC";
    $rounds = $joomleague->getRoundNames($ordering);
    
    $func=$jl_func;
    $favteams = explode(",", $joomleague->fav_team);
    
    //get project teams info
    $teams = $joomleague->getTeamsIndexedById();
    
    if ( $team_plan ) {
      if ($joomleague->teams_as_referees) {
      	// get info for refering
        $matches_refering = $joomleague->getResultsPlan(0, 0, $ordering, $team_plan, $showPlan_config['show_playground'], $showPlan_config['show_referee']);
        $teamsRefPlan = $joomleague->getTeamsFromMatches($matches_refering);
      }
	  }
    if($mode > 0){
      require(getTemplateFile(JL_TEMPLATE_PATH, 'show_results2.tpl.php'));
    }
    else{  
      $matches = $joomleague->getResultsPlan(0, $team_plan, $ordering, 0, $showPlan_config['show_playground'], $showPlan_config['show_referee']);
     
      require(getTemplateFile(JL_TEMPLATE_PATH, 'show_plan.tpl.php'));
    }    
// Spielplan Ende
//##########################################################################################################################
  }
?>